import log from '@dfeidao/atom-nodejs/logger/log';
import operate from '@dfeidao/atom-nodejs/db/operate';
import { systemid } from '../../atom/config';

interface Message {
	filter: {
		hidden_source: string[]
	};
}

export default async function atom(msg: Message, action_id: string, session_id: string) {
	log('Service begin');
	const { del, exec } = operate(action_id, session_id, systemid);
	del('asso_hidden_sou', { hidden_source: { $in: msg.filter.hidden_source } });

	// msg.filter.hidden_name.forEach((v, idx) => {
	// 	const name = msg.filter.hidden_name[idx][0];
	// 	const no = msg.filter.hidden_name[idx][1];
	// 	insert('asso_hidden_sou', { risk_po_name_no: result, hidden_source: no, hidden_name: name });
	// })

	const res = await exec();
	log('Service end');
	return res;
}
